#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <iostream>
#include <exception>
#include "Lexer.h"
#include <math.h>

using namespace std;
Util util;

void exibirStringEmConsole(string str){
	int i;
	for(i=0;i<str.length();i++){
		std::cout << str[i];
	}
}

int main(int argc, char *argv[]){
	Lexer lexer("teste1.txt", true);

	Token nextToken;

	do{
		try{
			nextToken = lexer.nextToken();
			if(!nextToken.lexema.empty()){
				exibirStringEmConsole(nextToken.toString());
				if(nextToken.tipo == TT_PONTO_VIRGULA){
					cout << endl;
				}
			}
		}catch (exception& e){
			cout << e.what() << endl;
		}
		cout << " ";
	}while(nextToken.tipo != TT_EOF);

	lexer.destruirLexer();

	cout << endl;
}

